﻿Imports System.Web

Namespace DotNetNuke.Modules.ActiveForums
    Public Class FilterController
        Public Function Filter_Save(filter As FilterInfo) As FilterInfo
            Dim filterId As Integer = DataProvider.Instance.Filters_Save(filter.PortalId, filter.ModuleId, filter.FilterId, filter.Find, filter.Replace, filter.FilterType)
            Return Filter_Get(filter.PortalId, filter.ModuleId, filterId)
        End Function
        Public Sub Filter_Delete(PortalId As Integer, ModuleId As Integer, FilterId As Integer)
            DataProvider.Instance.Filters_Delete(PortalId, ModuleId, FilterId)
        End Sub
        Public Function Filter_Get(ByVal PortalId As Integer, ByVal ModuleID As Integer, ByVal FilterId As Integer) As FilterInfo
            Dim fi As New FilterInfo
            Dim dr As IDataReader = DataProvider.Instance.Filters_Get(PortalId, ModuleID, FilterId)
            While dr.Read
                With fi
                    .FilterId = CInt(dr("FilterId").ToString())
                    .Find = dr("Find").ToString()
                    .Replace = dr("Replace").ToString()
                    .FilterType = dr("FilterType").ToString()
                    .ModuleId = ModuleID
                    .PortalId = PortalId
                    
                End With
            End While
            dr.Close()
            Return fi
        End Function
    End Class
End Namespace

